﻿
using com.iot.core.annotation;
using com.iot.core.exception;
using com.iot.core.util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace com.iot.core.data
{
    [Schema(Name = "分页日期查询类", Description = "")]
    public   class BasePageDtQto : BasePageQto
    {
        [Schema(Name = "开始日期", Description = "")]
        public string Dtb { get; set; } = "";
        [Schema(Name = "截至日期", Description = "")]
        public string Dte { get; set; } = "";

        public DateTime? GetDB()
        {
            if (!string.IsNullOrEmpty(Dtb))
            {
                try
                {
                    return DateTime.Parse(Dtb).Date;
                }
                catch (Exception e)
                {
                    throw new MyException("日期格式错误");
                }
            }
            return null;
        }
        public DateTime? GetDE()
        {
            if (!string.IsNullOrEmpty(Dte))
            {
                try
                {
                    return DateTime.Parse(Dte).Date.AddDays(1);
                }
                catch (Exception e)
                {
                    throw new MyException("日期格式错误");
                }
            }
            return null;
        } 
    }
}
